Skip to content

Accept an array of tables to exclude #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

neilgilmour
Copy link

This PR widens the scope of the exclude(string $tableName) method to also accept an array of table names. There's a passing test and updated docs.

I don't think that this constitutes a breaking change; The method still accepts a string, the parameter name is unchanged, the method performs the same actions, and the return value is unchanged.

@mechelon mechelon requested a review from Copilot June 13, 2025 14:37
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the exclude() and include() methods in DumpSchema to accept arrays of table names, adds corresponding tests, and updates documentation examples.

  • DumpSchema methods now handle both string and array inputs for table inclusion/exclusion
  • Added PHPUnit tests to cover array-based include/exclude scenarios
  • Updated docs with code snippets showing array usage

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
tests/DumperTest.php Added tests for array inputs in include/exclude and removed an unused import
src/DumpSchema.php Changed exclude and include signatures to accept arrays and implemented the new logic
docs/schema-definition.md Updated examples to demonstrate array support in exclude() and include()
tests/snapshots/* Updated snapshots to match new include/exclude behavior
Comments suppressed due to low confidence (4)

docs/schema-definition.md:129

  • Remove the trailing comma after the exclude method call in this code snippet to avoid syntax errors in the example.
        ->exclude(['password_resets', 'secrets', 'lies', 'cat_birthdays']),

docs/schema-definition.md:130

  • Remove the trailing comma after this exclude method call to ensure the code block is a valid example.
        ->exclude(config('database.forbidden_tables')),

src/DumpSchema.php:51

  • [nitpick] Consider renaming the parameter $tableName to $tableNames or $tables to reflect that it accepts multiple values.
public function exclude(string|array $tableName)

src/DumpSchema.php:81

  • [nitpick] Indent this line to align with the nested block inside the foreach for better readability and consistency.
$this->availableTables[] = $doctrineTable;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant